<template>
  <div style="margin-left: 70px">
    <el-tooltip class="item" effect="dark" content="刷新" placement="top">
      <el-button circle icon="Refresh" @click="update" />
    </el-tooltip>
  </div>
  
    <!--<el-table-column type="selection" width="55" />-->
    <el-table
      :data="WaitAssessorList"
      border
      style="width: 90%; margin: 20px auto;border-radius: 8px;box-shadow: 5px 5px 10px rgba(51, 126, 204, 0.5);"
      :header-cell-style="{
          'background': '#337ecc !important',
          'color': '#ffffff',
          'border': 'none !important'
        }">
    	
		
		<el-table-column prop="empName" label="被评人" width="180" />
		
    	<el-table-column prop="deptName" label="部门" />
    	<el-table-column prop="position" label="岗位"  />
    	<el-table-column prop="fileName" label="特定绩效文件" />
    	<el-table-column prop="parttimeReward" label="金额" width="80"/>
		<el-table-column prop="difficulty" label="难度系数" width="80"/>
		<el-table-column prop="assessorName" label="评分人" width="180" />
		
		<el-table-column prop="score" label="评分" width="250">
		    <template v-slot="scope">
		      <el-input
		        style="width: 200px"
		        v-model="scope.row.score"
		        placeholder="请填写评分（0~120）"
		        class="input"
		      />&nbsp;&nbsp;分
		    </template>
		</el-table-column>
		
		<el-table-column prop="remark" label="评分说明">
			<template v-slot="scope">
		      <el-input
				v-model="scope.row.remark"
		        type="textarea"
		        placeholder="请填写扣分或加分说明"
		        style="width: 100%; float: right"
		      />
			  </template>
		</el-table-column>
		
    	<el-table-column prop="amount1" label="操作" width="230">
			<template #default="scope">
			  <el-button type="success" @click="submitForm(scope.$index,scope.row)">提交</el-button>
			</template>
		</el-table-column>
		
    </el-table>
	
	<!-- <Dialog
	  v-model="DialogVisible"
	  :close="close"
	  :update="update"
	  :select="select"
	></Dialog>
	
	 -->
	
</template>
<script setup>
import { ref, onBeforeMount, reactive, getCurrentInstance,watch } from "vue";
import { Timer } from "@element-plus/icons-vue";
import { useRouter } from "vue-router";
import { getPartTimeTask ,finishPartTimeTask } from "@/api/person";
import { ElMessage } from "element-plus";
// import Dialog from "./components/partTimeScore";

var input = "425245"

const router = useRouter();

// const handleEdit = (index, row) => {};
// const handleDelete = (index, row) => {};
const WaitAssessorList = ref([]);

let empId = JSON.parse(localStorage.getItem("userInfo")).id;
onBeforeMount(() => {
  getPartTimeTask({ empId }).then((data) => {
    WaitAssessorList.value = data.data;
  });
});


// const onShowClick = (index,row) => {
//   router.push({
//     path: "./components/myOkr",
//     query: row,
//   });
// };

const update = () => {
  let empId = JSON.parse(localStorage.getItem("userInfo")).id;
  getPartTimeTask({ empId }).then((data) => {
    if (data.code == 200) {
      ElMessage({
        message: "更新成功",
        type: "success",
      });
      WaitAssessorList.value = data.data;
    } else {
      ElMessage.error("更新成功");
    }
  });
};


let select=reactive()

const DialogVisible = ref(false);

const handleEdit1=(index,row)=>{
  DialogVisible.value = true;
  select=row
}

// const update = () => {
	
//   // getMyOkr(213).then((data) => {
	  
//   // });
// };

const close = ()=>{
	
  DialogVisible.value = false;
}


const form=reactive({
  id:"",
  completionInstructions:""
})


const submitForm = (index , row) => {
	
	
    finishPartTimeTask(row).then(data=>{
      if (data.code == 200) {
        ElMessage({
          message: "评分成功",
          type: "success",
        });
        update()
		
      }
    })
};


</script>

<style lang="scss" scoped>
.step {
  width: 1000px;
  margin: 20px auto;
}
</style>
